import axios from '@/utils/request';

/**
 * 新增银行账户
 */
export async function AddBankaccount(params) {
    const res = await axios.post('/Bankaccount/AddBankaccount',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 获取银行账户查询分页列表
 */
 export async function QueryBankaccountPageList(params) {
    const res = await axios.post('/Bankaccount/QueryBankaccountPageList',params);
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 根据id获取银行账户
 */
 export async function GetBackAccountById(id) {
    const res = await axios.get('/Bankaccount/GetModelById/'+id);
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 更新银行账户
 */
 export async function UpdateBankaccount(params) {
    const res = await axios.post('/Bankaccount/UpdateBankaccount',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 更新银行账户
 */
 export async function DeleteBankaccount(id) {
    const res = await axios.post('/Bankaccount/DeleteBankaccount?id='+id);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}



 /**
  * 修改银行账户状态信息
  */
 export async function UpdateStatus(params) {
    const res = await axios.post('/Bankaccount/UpdateStatus',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
  }

/**
 * 获取所有的银行账户
 */
export async function GetAllBackAccount() {
    const res = await axios.get('/Bankaccount/GetAllModels');
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}


/**
 * 新增银行账户期初设置
 */
export async function AddBankLintsetting(params) {
    const res = await axios.post('/BankLintsetting/AddBankLintsetting',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 更新银行账户期初设置
 */
export async function UpdateBankLintsetting(params) {
    const res = await axios.post('/BankLintsetting/UpdateBankLintsetting',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 根据id获取银行账户期初设置
 */
export async function GetBankLintsettingById(id) {
    const res = await axios.get('/BankLintsetting/GetBankLintsettingById?id='+id);
    return res.data.data;
}

